//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

import java.util.Vector;

public class Tank {
    private int type;
    private int x;
    private int y;
    private int speed;
    private int direction;

    private boolean life;
    public boolean isLife() {
        return life;
    }

    public void setLife(boolean life) {
        this.life = life;
    }

    Tank(int x, int y) {
        this.x = x;
        this.y = y;
    }

    Vector<Bullet> bulletvector = new Vector<>();
    public int getType() {
        return this.type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getX() {
        return this.x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return this.y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getSpeed() {
        return this.speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public int getDirection() {
        return this.direction;
    }

    public void setDirection(int direction) {
        this.direction = direction;
    }

    public void up() {
        if(this.getY() - this.getSpeed() >= 7){
            this.setY(this.getY() - this.getSpeed());
        }
    }

    public void left() {
        if(this.getX() - this.getSpeed() >= 0){
            this.setX(this.getX() - this.getSpeed());
        }
    }

    public void right() {
        if(this.getX() + this.getSpeed() <= 1500 - 44){
            this.setX(this.getX() + this.getSpeed());
        }
    }

    public void down() {
        if(this.getY() + this.getSpeed() <= 700 - 44){
            this.setY(this.getY() + this.getSpeed());

        }
    }

    public void attack(){
//        if(bulletvector.size() < 5){
            Bullet bullet = new Bullet(this.getX() + 44, this.getY() + 70, this.getDirection());
            switch(this.getDirection()){
                case 0:
                    bulletvector.add(bullet);
                    break;
                case 1:
                    bullet = new Bullet(this.getX() + 44, this.getY() -20, this.getDirection());
                    bulletvector.add(bullet);
                    break;
                case 2:
                    bullet = new Bullet(this.getX() + 70, this.getY() + 44, this.getDirection());
                    bulletvector.add(bullet);
                    break;
                case 3:
                    bullet = new Bullet(this.getX() - 26, this.getY() + 44, this.getDirection());
                    bulletvector.add(bullet);
                    break;

            }
            Thread thread = new Thread(bullet);
            thread.start();
//        }

    }
    public void skill(){

    }
}
